import { http } from '@/utils/request'
const { VITE_BASE_URL_POST, MODE } = import.meta.env

// 判断是否是生产环境
const isProduction = MODE === 'production'
// const isProduction = MODE !== 'production'

// 动态拼接前缀
const API_PREFIX = isProduction ? '/early-warning-web/api' : ''
// 预警事件
export const getAlarmEventListApi = (params) => {
  return http.get(`${API_PREFIX}/city/page`, {
    params,
    tokenType: 'identification',
  })
}

// 区县叫应
export const countyCallingApi = (id) => {
  return http.post(
    `${API_PREFIX}/city/request/${id}`,
    {},
    {
      tokenType: 'identification',
    },
  )
}

// 预警降雨轮次下拉
export function getConditionsApi() {
  return http.get(
    `${API_PREFIX}/weather_early/conditions`,
    {},
    {
      tokenType: 'identification',
    },
  )
}

// 响应任务
export const getResponesTaskListApi = (data) => {
  return http.post(
    `/cqwl/re/event/listYd?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    data,
  )
}
// 获取班组长
export const getBzOptions = (data) => {
  return http.post(`/cqwl/re/yj/Class/findClass`, data)
}

// 创建工单
export const createWorkApi = (data) => {
  return http.post(`/cqwl/re/work/saveYd`, data)
}

// 获取处置时间列表
export const getDisposeEventListApi = (data) => {
  return http.post(
    `/cqwl/biz/yj/AlarmManage/findList?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
    data,
  )
}

// 获取处置情况数据
export function getPlanManageByPointId(data) {
  return http.post(`/cqwl/biz/plan/getPointId`, data)
}

// 处置事件创建工单
export function setWorkSave(data) {
  return http.post(`/cqwl/biz/work/save`, data)
}
// 处置事件办结
export function completedWorkApi(id) {
  return http.post(`/cqwl/biz/yj/AlarmManage/completed/${id}`)
}

// 获取风险点位
export function getPlanManageByCountyCode1(data) {
  return http.post(`/cqwl/re/plan/getPlanManageByCountyCode1/`, data)
}

// 获取点位信息
export function getRePlanManageByPointId(id) {
  return http.post(`/cqwl/re/plan/getPointId/${id}`)
}

// 根据班组id查询班组信息
export function getClassInfoById(data) {
  return http.post(`/cqwl/re/yj/Car/byClassId`, data)
}
// 获取降雨轮次查询列表数据
export function getSelectRainfallCycle(params) {
  return http.get(`/cqwl/re/work/selectRainfallCycle`, { params })
}

//获取区域响应上报查询列表数据

export function reportworkData(data) {
  return http.post(`/cqwl/re/work/listYq`, data)
}
